﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.IO;

namespace NUMIMAX
{
    class WebDownloader
    {
        public static string GetWebPage(string adresStrony)
        {
            string strNewValue = "";
            string strResponse = "";

            HttpWebRequest req = (HttpWebRequest)WebRequest.Create(adresStrony);
            req.Proxy = null;
            req.Method = "POST";

            req.ContentType = "application/x-www-form-urlencoded";
            strNewValue = "login=" + "&haslo=";
            req.ContentLength = strNewValue.Length;
            StreamWriter stOut = new StreamWriter(req.GetRequestStream(), System.Text.Encoding.Default);
            stOut.Write(strNewValue);
            stOut.Close();
            StreamReader stIn = new StreamReader(req.GetResponse().GetResponseStream());
            strResponse = stIn.ReadToEnd();
            stIn.Close();

            return strResponse.ToString();
        }
    }
}
